package cn.yl.caner.service;

import java.sql.SQLException;

import cn.yl.caner.dao.FindDao;
import cn.yl.caner.domain.AccountData;
import cn.yl.caner.domain.FindData;
import cn.yl.caner.utils.MyDataSourceUtils;

public class FindService {
	
	public AccountData findAccount(FindData finddata) {
		//service层，对查询信息提交事务，转换至DAO层
		FindDao finddao = new FindDao();
		AccountData accountData =null;
		try {
			MyDataSourceUtils.start();
			 accountData = finddao.findAccound(finddata);
		} catch (SQLException e) {
			try {
				//回滚
				MyDataSourceUtils.rollback();
			} catch (SQLException e1) {
				System.out.println("回滚失败");
			}
			System.out.println("事物出现错误");
		}finally{
			try {
				//提交
				MyDataSourceUtils.commit();
			} catch (SQLException e) {
				System.out.println("事物提交失败！！");
			}
		}
		return  accountData;
		
	}
}
